<template>
  <div class="color-grey">
    <el-form
      ref="form"
      :model="signupForm"
      label-width="80px"
      class="form-signin "
    >
      <h1>请注册!</h1>
      <div>
        <i class="fa fa-user-o fa-5x adminimg" aria-hidden="true"></i>
      </div>
      <el-form-item label="登录账号">
        <el-input v-model="signupForm.userName" placeholder="您的ID"></el-input
      ></el-form-item>
      <el-form-item label="输入密码">
        <el-input
          type="password"
          v-model="signupForm.password"
          placeholder="您的密码"
        ></el-input
      ></el-form-item>
      <el-form-item label="确定密码">
        <el-input
          type="password"
          v-model="signupForm.confirmPassword"
          placeholder="确定密码"
        ></el-input
      ></el-form-item>

      <el-button style="width:100%" type="primary" @click="signup()">
        注册
      </el-button>
    </el-form>
  </div>
</template>

<script>
export default {
  name: "AdminSignup",
  data() {
    return {
      signupForm: {
        userName: "",
        password: "",
        confirmPassword: ""
      }
    };
  },
  methods: {
    signup() {
      this.$axios.post("/user/signup", this.signupForm).then(res => {
        this.$message.success("注册成功");
        this.$router.push({
          name: "Login"
        });
      });
    }
  }
};
</script>

<style scoped>
/*设置背景颜色*/

.form-signin {
  max-width: 400px;
  padding: 15px 35px 45px;
  margin: 0 auto;
  background-color: #ffffff;
}

.color-grey {
  background-color: #eee;
  height: 100%;
}
</style>
